/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Anali
 */
@Entity
@Table(name = "submodulo")
@NamedQueries({
    @NamedQuery(name = "Submodulo.findAll", query = "SELECT s FROM Submodulo s"),
    @NamedQuery(name = "Submodulo.findByIdSubModulo", query = "SELECT s FROM Submodulo s WHERE s.idSubModulo = :idSubModulo"),
    @NamedQuery(name = "Submodulo.findByNombreSubModulo", query = "SELECT s FROM Submodulo s WHERE s.nombreSubModulo = :nombreSubModulo")})
public class Submodulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idSubModulo")
    private Integer idSubModulo;
    @Basic(optional = false)
    @Column(name = "nombreSubModulo")
    private String nombreSubModulo;
    @JoinColumn(name = "idModulo", referencedColumnName = "idModulo")
    @ManyToOne(optional = false)
    private Modulo modulo;

    public Submodulo() {
    }

    public Submodulo(Integer idSubModulo) {
        this.idSubModulo = idSubModulo;
    }

    public Submodulo(Integer idSubModulo, String nombreSubModulo) {
        this.idSubModulo = idSubModulo;
        this.nombreSubModulo = nombreSubModulo;
    }

    public Integer getIdSubModulo() {
        return idSubModulo;
    }

    public void setIdSubModulo(Integer idSubModulo) {
        this.idSubModulo = idSubModulo;
    }

    public String getNombreSubModulo() {
        return nombreSubModulo;
    }

    public void setNombreSubModulo(String nombreSubModulo) {
        this.nombreSubModulo = nombreSubModulo;
    }

    public Modulo getModulo() {
        return modulo;
    }

    public void setModulo(Modulo modulo) {
        this.modulo = modulo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSubModulo != null ? idSubModulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Submodulo)) {
            return false;
        }
        Submodulo other = (Submodulo) object;
        if ((this.idSubModulo == null && other.idSubModulo != null) || (this.idSubModulo != null && !this.idSubModulo.equals(other.idSubModulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Submodulo[idSubModulo=" + idSubModulo + "]";
    }

}
